package com.baselibrary.net.result;

/**
 * @author zhanglijie
 * @date 17/7/30
 */

public class HttpResult<T> {

    private int code;

    private String message;
    private String msg;
    private boolean success;
    private String json;

    private T data;


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        if (data == null)
            return (T) "";
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    @Override
    public String toString() {
        return "{" +
                "\"code\":" + code +
                ", \"message\":\"" + message + "\"" +
                ", \"success\":" + success +
                ", \"data\":" + data +
                '}';
    }

    public String getJson() {
        return json;
    }

    public void setJson(String json) {
        this.json = json;
    }
}
